package com.health.controller;

import com.health.domain.dto.OrderDTO;
import com.health.domain.vo.OrderInfo;
import com.health.domain.vo.Result;
import com.health.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ghy
 * @version 1.0
 * @since 2025-06-24 16:18
 */
@RestController
@RequestMapping("/order")
@Slf4j
public class OrderController {

    @Autowired
    private OrderService orderService;


    @PostMapping("/submit")
    public Result<Integer> submit(@RequestBody OrderDTO orderDTO) {
        log.info("{}", orderDTO);
        return orderService.submit(orderDTO);
    }

    @PostMapping("/findById")
    public Result<OrderInfo> findById(Integer id){
        log.info("{}", id);
        return orderService.findById(id);
    }

}
